Imports Janus.Windows.GridEX
Public Class frmSUBITEM

    Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Me.Close()
    End Sub

    Private Sub btnSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelect.Click
        GridSelect.BoundMode = BoundMode.Unbound
        If GridSubItem.RowCount > 0 Then
            If GridSubItem.CurrentRow.RowType = Janus.Windows.GridEX.RowType.GroupHeader Then
                Dim row As Janus.Windows.GridEX.GridEXRow
                For Each row In GridSubItem.CurrentRow.GetChildRows
                    Dim newRow As GridEXRow = GridSelect.AddItem()
                    newRow.BeginEdit()
                    newRow.Cells("SUBITEM_NAME").Value = row.Cells("SUBITEM_NAME").Text
                    newRow.Cells("SUBITEM_CODE").Value = row.Cells("SUBITEM_CODE").Text
                    newRow.EndEdit()
                Next
            Else
                Dim CurRow As GridEXRow = GridSubItem.CurrentRow
                Dim newRow As GridEXRow = GridSelect.AddItem()
                newRow.BeginEdit()
                newRow.Cells("SUBITEM_NAME").Value = CurRow.Cells("SUBITEM_NAME").Text
                newRow.Cells("SUBITEM_CODE").Value = CurRow.Cells("SUBITEM_CODE").Text
                newRow.EndEdit()
            End If
        End If
    End Sub

    Private Sub btnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRemove.Click
        GridSelect.CurrentRow.Delete()
    End Sub

    Private Sub frmSUBITEM_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        Try
            GC.Collect()
            Me.Dispose()
        Catch ex As Exception

        End Try
    End Sub

    Private Sub frmSUBITEM_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        PublicFunction.NewFormLoad(Me)
    End Sub
End Class